<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>Templates | Raxan User Guide</title>
    <link href="../raxan/styles/master.css" rel="stylesheet" type="text/css" />
    <!--[if IE]><link rel="stylesheet" href="../raxan/styles/master.ie.css" type="text/css"><![endif]-->
    <link href="style.css" rel="stylesheet" type="text/css" />
    <link href="highlight/styles/default.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="highlight/highlight.js"></script>
    <script type="text/javascript">
        hljs.initHighlightingOnLoad('javascript','html','php');
    </script>

</head>

<body>
    <div class="container c48 prepend-top">
        <h2 class="bottom">Raxan User Guide</h2>
        <div class="navbar">
            <div class="lf"><div class="rt"><div class="md">
                <ul>
                    <li><a href="../index.html" title="The Rich Ajax, CSS &amp; PHP Framework" >Home</a></li>
                    <li><a href="table-of-contents.html" title="Blog Posts" >Table Of Contents</a></li>
                    <li><a href="../php-examples/index.php" title="PHP Examples" >PHP Examples</a></li>
                    <li><a href="../css-examples/index.html" title="User Guide" >CSS Examples</a></li>
                </ul>
            </div></div></div>
        </div>
        <div class="prepend1 append1">
            <div class="ltm" align="right">
                <a href="table-of-contents.html" title="Show Table of Content">
                    <img src="images/toc-button.png"  alt="Table of Contents" />
                </a>
            </div>
            <h2>Template Management</h2>

<p>Templates are reusable html pages that provide an easy way to change the look and feel of a web page or application.</p>

<p>Templates contain the basic html structure for needed for rendering a page. The content page should only provide the html needed to render the content of the page.</p>

<p>Before you can use a template you need to identify the content area of the template by assigning the "master-content" css class name to an element withing the template.</p>

<pre><code>&lt;!DOCTYPE html&gt;

&lt;html&gt;
    &lt;head&gt;
        &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/&gt;
        &lt;title&gt;My Website&lt;/title&gt;
    &lt;/head&gt;

    &lt;body&gt;
        &lt;h2&gt;My Website&lt;/h2&gt;
        &lt;div class="master-content"&gt;
            &lt;!-- your content will be loaded here --&gt;
        &lt;/div&gt;
    &lt;/body&gt;

&lt;/html&gt;
</code></pre>

<p>To set or change the template of a web page,you will need to declare and set the $masterTemplate page property as shown below:</p>

<pre><code>&lt;?php

    require_once('raxan/pdi/autostart.php');

    class NewPage extends RaxanWebPage {

        protected $masterTemplate = 'mytemplate.html';

        protected function _load($e) {
            $this-&gt;content('Hello World');
        }
    }

?&gt;
</code></pre>

<p>In addition to setting the $masterTemplate of the page, you can optionally set the $masterContentBlock property to use your own template content css selector. The default template content selector is ".master-content".</p>

        </div>
        <div class="tpb pad" style="text-align:right">
            <div class="right ltm">
                <a href="table-of-contents.html" title="Back to Table of Content">
                    <img src="images/toc-button.png"  alt="Table of Contents" />
                </a>
            </div>
        </div>
    </div>
</body>

</html>

